/*
 * Amazon Ads API - Sponsored Products
 * Use the Amazon Ads API for Sponsored Products for campaign, ad group, keyword, negative keyword, and product ad management operations. For more information about Sponsored Products, see the [Sponsored Products Support Center](https://advertising.amazon.com/help?entityId=ENTITY3CWETCZD9HEG2#GWGFKPEWVWG2CLUJ). For onboarding information, see the [account setup](setting-up/account-setup) topic.<br/><br/> 
 *
 * The version of the OpenAPI document: 2.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.openapitools.client.api;

import org.openapitools.client.ApiCallback;
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
import org.openapitools.client.ProgressRequestBody;
import org.openapitools.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import java.math.BigDecimal;
import org.openapitools.client.model.CreateProductAd;
import org.openapitools.client.model.Error;
import org.openapitools.client.model.ProductAd;
import org.openapitools.client.model.ProductAdEx;
import org.openapitools.client.model.ProductAdResponse;
import org.openapitools.client.model.UpdateProductAd;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProductAdsApi {
    private ApiClient localVarApiClient;

    public ProductAdsApi() {
        this(Configuration.getDefaultApiClient());
    }

    public ProductAdsApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    /**
     * Build call for archiveProductAd
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call archiveProductAdCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/productAds/{adId}"
            .replaceAll("\\{" + "adId" + "\\}", localVarApiClient.escapeString(adId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call archiveProductAdValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling archiveProductAd(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling archiveProductAd(Async)");
        }
        
        // verify the required parameter 'adId' is set
        if (adId == null) {
            throw new ApiException("Missing the required parameter 'adId' when calling archiveProductAd(Async)");
        }
        

        okhttp3.Call localVarCall = archiveProductAdCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, _callback);
        return localVarCall;

    }

    /**
     * Archives a product ad.
     * Sets the state of a specified product ad to &#x60;archived&#x60;. Note that once the state is set to &#x60;archived&#x60; it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @return ProductAdResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ProductAdResponse archiveProductAd(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId) throws ApiException {
        ApiResponse<ProductAdResponse> localVarResp = archiveProductAdWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId);
        return localVarResp.getData();
    }

    /**
     * Archives a product ad.
     * Sets the state of a specified product ad to &#x60;archived&#x60;. Note that once the state is set to &#x60;archived&#x60; it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @return ApiResponse&lt;ProductAdResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<ProductAdResponse> archiveProductAdWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId) throws ApiException {
        okhttp3.Call localVarCall = archiveProductAdValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, null);
        Type localVarReturnType = new TypeToken<ProductAdResponse>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Archives a product ad. (asynchronously)
     * Sets the state of a specified product ad to &#x60;archived&#x60;. Note that once the state is set to &#x60;archived&#x60; it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call archiveProductAdAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback<ProductAdResponse> _callback) throws ApiException {

        okhttp3.Call localVarCall = archiveProductAdValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, _callback);
        Type localVarReturnType = new TypeToken<ProductAdResponse>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for createProductAds
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createProductAd A list of product ads for creation. Note that the &#x60;SKU&#x60; field is used by sellers and the &#x60;ASIN&#x60; field is used by vendors. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createProductAdsCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateProductAd> createProductAd, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = createProductAd;

        // create path and map variables
        String localVarPath = "/v2/sp/productAds";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call createProductAdsValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateProductAd> createProductAd, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling createProductAds(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling createProductAds(Async)");
        }
        

        okhttp3.Call localVarCall = createProductAdsCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createProductAd, _callback);
        return localVarCall;

    }

    /**
     * Creates one or more product ads.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createProductAd A list of product ads for creation. Note that the &#x60;SKU&#x60; field is used by sellers and the &#x60;ASIN&#x60; field is used by vendors. (optional)
     * @return List&lt;ProductAdResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<ProductAdResponse> createProductAds(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateProductAd> createProductAd) throws ApiException {
        ApiResponse<List<ProductAdResponse>> localVarResp = createProductAdsWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createProductAd);
        return localVarResp.getData();
    }

    /**
     * Creates one or more product ads.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createProductAd A list of product ads for creation. Note that the &#x60;SKU&#x60; field is used by sellers and the &#x60;ASIN&#x60; field is used by vendors. (optional)
     * @return ApiResponse&lt;List&lt;ProductAdResponse&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<ProductAdResponse>> createProductAdsWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateProductAd> createProductAd) throws ApiException {
        okhttp3.Call localVarCall = createProductAdsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createProductAd, null);
        Type localVarReturnType = new TypeToken<List<ProductAdResponse>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Creates one or more product ads. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createProductAd A list of product ads for creation. Note that the &#x60;SKU&#x60; field is used by sellers and the &#x60;ASIN&#x60; field is used by vendors. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createProductAdsAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateProductAd> createProductAd, final ApiCallback<List<ProductAdResponse>> _callback) throws ApiException {

        okhttp3.Call localVarCall = createProductAdsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createProductAd, _callback);
        Type localVarReturnType = new TypeToken<List<ProductAdResponse>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getProductAd
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getProductAdCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/productAds/{adId}"
            .replaceAll("\\{" + "adId" + "\\}", localVarApiClient.escapeString(adId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getProductAdValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling getProductAd(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling getProductAd(Async)");
        }
        
        // verify the required parameter 'adId' is set
        if (adId == null) {
            throw new ApiException("Missing the required parameter 'adId' when calling getProductAd(Async)");
        }
        

        okhttp3.Call localVarCall = getProductAdCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, _callback);
        return localVarCall;

    }

    /**
     * Gets a product ad specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @return ProductAd
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ProductAd getProductAd(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId) throws ApiException {
        ApiResponse<ProductAd> localVarResp = getProductAdWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId);
        return localVarResp.getData();
    }

    /**
     * Gets a product ad specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @return ApiResponse&lt;ProductAd&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<ProductAd> getProductAdWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId) throws ApiException {
        okhttp3.Call localVarCall = getProductAdValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, null);
        Type localVarReturnType = new TypeToken<ProductAd>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets a product ad specified by identifier. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getProductAdAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback<ProductAd> _callback) throws ApiException {

        okhttp3.Call localVarCall = getProductAdValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, _callback);
        Type localVarReturnType = new TypeToken<ProductAd>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getProductAdEx
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getProductAdExCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/productAds/extended/{adId}"
            .replaceAll("\\{" + "adId" + "\\}", localVarApiClient.escapeString(adId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getProductAdExValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling getProductAdEx(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling getProductAdEx(Async)");
        }
        
        // verify the required parameter 'adId' is set
        if (adId == null) {
            throw new ApiException("Missing the required parameter 'adId' when calling getProductAdEx(Async)");
        }
        

        okhttp3.Call localVarCall = getProductAdExCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, _callback);
        return localVarCall;

    }

    /**
     * Gets extended data for a product ad specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @return ProductAdEx
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ProductAdEx getProductAdEx(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId) throws ApiException {
        ApiResponse<ProductAdEx> localVarResp = getProductAdExWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId);
        return localVarResp.getData();
    }

    /**
     * Gets extended data for a product ad specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @return ApiResponse&lt;ProductAdEx&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<ProductAdEx> getProductAdExWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId) throws ApiException {
        okhttp3.Call localVarCall = getProductAdExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, null);
        Type localVarReturnType = new TypeToken<ProductAdEx>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets extended data for a product ad specified by identifier. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param adId A product ad identifier. (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getProductAdExAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal adId, final ApiCallback<ProductAdEx> _callback) throws ApiException {

        okhttp3.Call localVarCall = getProductAdExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, adId, _callback);
        Type localVarReturnType = new TypeToken<ProductAdEx>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listProductAds
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param adIdFilter Restricts results to product ads associated with the product ad identifiers specified in the comma-delimited list. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listProductAdsCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/productAds";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (startIndex != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("startIndex", startIndex));
        }

        if (count != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("count", count));
        }

        if (stateFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("stateFilter", stateFilter));
        }

        if (campaignIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaignIdFilter", campaignIdFilter));
        }

        if (adGroupIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("adGroupIdFilter", adGroupIdFilter));
        }

        if (adIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("adIdFilter", adIdFilter));
        }

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call listProductAdsValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling listProductAds(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling listProductAds(Async)");
        }
        

        okhttp3.Call localVarCall = listProductAdsCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, adIdFilter, _callback);
        return localVarCall;

    }

    /**
     * Gets a list of product ads filtered by specified criteria.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param adIdFilter Restricts results to product ads associated with the product ad identifiers specified in the comma-delimited list. (optional)
     * @return List&lt;ProductAd&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<ProductAd> listProductAds(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter) throws ApiException {
        ApiResponse<List<ProductAd>> localVarResp = listProductAdsWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, adIdFilter);
        return localVarResp.getData();
    }

    /**
     * Gets a list of product ads filtered by specified criteria.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param adIdFilter Restricts results to product ads associated with the product ad identifiers specified in the comma-delimited list. (optional)
     * @return ApiResponse&lt;List&lt;ProductAd&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<ProductAd>> listProductAdsWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter) throws ApiException {
        okhttp3.Call localVarCall = listProductAdsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, adIdFilter, null);
        Type localVarReturnType = new TypeToken<List<ProductAd>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets a list of product ads filtered by specified criteria. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param adIdFilter Restricts results to product ads associated with the product ad identifiers specified in the comma-delimited list. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listProductAdsAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter, final ApiCallback<List<ProductAd>> _callback) throws ApiException {

        okhttp3.Call localVarCall = listProductAdsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, adIdFilter, _callback);
        Type localVarReturnType = new TypeToken<List<ProductAd>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listProductAdsEx
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param adIdFilter Restricts results to product ads associated with the product ad identifiers specified in the comma-delimited list. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listProductAdsExCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/productAds/extended";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (startIndex != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("startIndex", startIndex));
        }

        if (count != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("count", count));
        }

        if (stateFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("stateFilter", stateFilter));
        }

        if (campaignIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaignIdFilter", campaignIdFilter));
        }

        if (adGroupIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("adGroupIdFilter", adGroupIdFilter));
        }

        if (adIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("adIdFilter", adIdFilter));
        }

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call listProductAdsExValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling listProductAdsEx(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling listProductAdsEx(Async)");
        }
        

        okhttp3.Call localVarCall = listProductAdsExCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, adIdFilter, _callback);
        return localVarCall;

    }

    /**
     * Gets extended data for a list of product ads filtered by specified criteria.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param adIdFilter Restricts results to product ads associated with the product ad identifiers specified in the comma-delimited list. (optional)
     * @return List&lt;ProductAdEx&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<ProductAdEx> listProductAdsEx(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter) throws ApiException {
        ApiResponse<List<ProductAdEx>> localVarResp = listProductAdsExWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, adIdFilter);
        return localVarResp.getData();
    }

    /**
     * Gets extended data for a list of product ads filtered by specified criteria.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param adIdFilter Restricts results to product ads associated with the product ad identifiers specified in the comma-delimited list. (optional)
     * @return ApiResponse&lt;List&lt;ProductAdEx&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<ProductAdEx>> listProductAdsExWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter) throws ApiException {
        okhttp3.Call localVarCall = listProductAdsExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, adIdFilter, null);
        Type localVarReturnType = new TypeToken<List<ProductAdEx>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets extended data for a list of product ads filtered by specified criteria. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param adIdFilter Restricts results to product ads associated with the product ad identifiers specified in the comma-delimited list. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listProductAdsExAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String adIdFilter, final ApiCallback<List<ProductAdEx>> _callback) throws ApiException {

        okhttp3.Call localVarCall = listProductAdsExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, adIdFilter, _callback);
        Type localVarReturnType = new TypeToken<List<ProductAdEx>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for updateProductAds
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateProductAd A list of product ad objects with updated values for the &#x60;state&#x60; field. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. A list of product ad objects with updated fields, in the same order as the list in the request body. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateProductAdsCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateProductAd> updateProductAd, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = updateProductAd;

        // create path and map variables
        String localVarPath = "/v2/sp/productAds";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateProductAdsValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateProductAd> updateProductAd, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling updateProductAds(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling updateProductAds(Async)");
        }
        

        okhttp3.Call localVarCall = updateProductAdsCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateProductAd, _callback);
        return localVarCall;

    }

    /**
     * Updates one or more product ads specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateProductAd A list of product ad objects with updated values for the &#x60;state&#x60; field. (optional)
     * @return List&lt;ProductAdResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. A list of product ad objects with updated fields, in the same order as the list in the request body. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<ProductAdResponse> updateProductAds(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateProductAd> updateProductAd) throws ApiException {
        ApiResponse<List<ProductAdResponse>> localVarResp = updateProductAdsWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateProductAd);
        return localVarResp.getData();
    }

    /**
     * Updates one or more product ads specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateProductAd A list of product ad objects with updated values for the &#x60;state&#x60; field. (optional)
     * @return ApiResponse&lt;List&lt;ProductAdResponse&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. A list of product ad objects with updated fields, in the same order as the list in the request body. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<ProductAdResponse>> updateProductAdsWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateProductAd> updateProductAd) throws ApiException {
        okhttp3.Call localVarCall = updateProductAdsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateProductAd, null);
        Type localVarReturnType = new TypeToken<List<ProductAdResponse>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Updates one or more product ads specified by identifier. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateProductAd A list of product ad objects with updated values for the &#x60;state&#x60; field. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. A list of product ad objects with updated fields, in the same order as the list in the request body. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateProductAdsAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateProductAd> updateProductAd, final ApiCallback<List<ProductAdResponse>> _callback) throws ApiException {

        okhttp3.Call localVarCall = updateProductAdsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateProductAd, _callback);
        Type localVarReturnType = new TypeToken<List<ProductAdResponse>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
